mob/npc
	var
		NPCon
	proc
		FindOrderedText(txt)
			var
				w
				pos
				lastpos = 1

			for(w in args)
				if(w == txt) continue
				pos = findtext(txt,w,lastpos)

				if(!pos) find_alt_word:
					if(!findtext(w,"|")) return
					//alternate words separated by |
					var/global/alt_lst[0] //for speed, cache alt lists here (indexed by original string)
					var/alts = alt_lst[w]
					if(!alts)
						alts = AltWordList(w)
						alt_lst[w] = alts
					for(w in alts)
						pos = findtext(txt,w,lastpos)
						if(pos) break find_alt_word
					return

				lastpos = pos
			return lastpos

		AltWordList(w)
			var/lst[0]
			var/endpos = lentext(w)+1
			var/pos
			var/lastpos = 1
			while(lastpos < endpos)
				pos = findtext(w,"|",lastpos)
				if(!pos) pos = endpos
				lst += copytext(w,lastpos,pos)
				lastpos = pos+1
			return lst

		ReactToSpeech(txt)
	verb
		saynpc(t as text, n as text)
			set hidden = 1
			if(!n)
				n = src.name
			oview(6,src) << ("<font color=[rgb(src.Red,src.Green,src.Blue)]>[n]</font>: [t]")
			var/mob/npc/R
			for (R in oview(src))
				if(R!=src)
					R.ReactToSpeech(t,src)
	Helper
		New()
			tag = "NoBoot"
		icon = 'pc npc.dmi'
		icon_state = "helper"
		name = {"Helper - to ask me questions use /say "help"}

		density = 1
		Red=255
		Green=0
		Blue=0
		ReactToSpeech(txt,src)
			spawn(lentext(txt))
				var/sleeptime=rand(10,50)
				var/NPCtext =""
				if (!NPCon)
					if(FindOrderedText(txt,"help"))
						NPCtext=pick ("Hiya [src] Im the Helper feel free to talk to me.","Hey [src]. Ask me anything to do with the game.","Welcome [src], to Castle of the Winds. I'm your helper for the time being so feel free to ask me what you want to know.")
						NPCon = 1
					if(NPCtext<>"")
						sleep(sleeptime)
						saynpc(NPCtext)
						saynpc(NPCtext)
				else
					if(FindOrderedText(txt,"helper" && "shut" &&"up"))
						NPCtext=pick ("Sure, I hope I helped you.","Sure.")
						NPCon = 0
					else if(FindOrderedText(txt,"help"))
						NPCtext=pick ("You need help on how I work right?<BR>   Well regardless you get some.<BR>   You can ask me about certain subjects in game. These are; developers, about, spells, items, armour, links, monsters, history, demo.")
					else if(FindOrderedText(txt,"castle", "winds"))
						NPCtext=pick ("What a great game.","Created by Maz, splattergnome and Jon88.","I am so glad that splatty and Maz gave me artificial intelligence")
					else if(FindOrderedText(txt,"bad", "gnome"))
						NPCtext=pick ("Bad splattergnome!","Nobody likes splattergnome",".")
					else if(FindOrderedText(txt,"w00t"))
						NPCtext=pick ("w00t? what are you l33t or something","w00t? Gah, stop using that!")
					else if(FindOrderedText(txt,"demo"))
						NPCtext=pick ("What you are playing now is a demo version of the real thing, there still is nothing to attack. But you do have some admin commands so you can make some monsters","w00t? Gah, stop using that!")
					else if(FindOrderedText(txt,"spells"))
						NPCtext=pick ({"We have plans to include all of the original spells. These are <BR>MagicMissile, ColdBolt, LightningBolt, FireBolt, ColdBall, LightningBall, FireBall, Clairvoyance, SleepMonster, SlowMonster, TransmogrifyMonster, HasteMonster, CloneMonster and TeleportAway "},{"Spells are cool, we plan on adding some more into the game. See <a href = "http://games.byond.com/forums/Maz/CastleoftheWinds/index.cgi?action=message_read&id=38&forum=1&view=2">here</a>"})
					else if(FindOrderedText(txt,"monsters"))
						NPCtext=pick ("In the original CotWs there were many different monsters. Some were hard, some were.. well some were Rats. ","As with spells the developers of Castle Online have already made the mobs for the monsters. As of yet there is no monster A.I. This is generally because Maz is lazy!")
					else if(FindOrderedText(txt,"developers"))
						NPCtext=pick ({"There was originally 1 developer for this project; Maz. He started this in the hopes of making a massive online RPG that people can all access the source and edit it to improve it. (optimistic, I know but hey..) The task though became too daunting, espeically the random dungeon matrix. Even with the help from Rick it seemed beyond him. This is when splattergnome got interested in Maz's secret project. splattergnomes knowlege of random maps was good as shown by <a href = "http://games.byond.com/hub/splattergnome/splattertag">splattertag</a>. Then as Maz worked the engine and splatter works the maze, Maz hit a half obsticle. He had some knowlege of Forms and html but it was pretty sucky and so in our resident Chat room <a href = "http://games.byond.com/hub/Xooxer/Chatters">Chatters</a> Jon88 gave out lots of help and offered to try his hand at making our bars system that is employed in the new character form. As Jon was qite happy to play around with the source (note that Maz wanted it to be opensourced so he gave the uber-alpha versions around quite freely) he decided he wanted to stick and that decision has been unchallenged by anyone, Its thanks to Jon we have such cool Admin commands! (For more info you can say; jon88, splattergnome or maz) "},{"Three developers; Maz (Main coder...{those who use the byond forums will know how cliche that phrase is.}), splattergnome (Dungeon maker) and Jon88 ( duh... Stuff guy!{Nah he makes stuff! like saving.) feel free to query me for more about each indivdual.  "})
					else if(FindOrderedText(txt,"maz"))
						NPCtext=pick ("Maz is the self-proclaimed main coder. He works tirelessly and effortlessly <font size = -1>(If Stephen King was reading this he would freak)</font> to try and make the game run smooth and be small in file size",{"Maz a.k.a Ben 'Maz' Maslen.<br>Can be found in <a href = "http://games.byond.com/hub/Xooxer/Chatters">Chatters</a>, can be found on trains traveling across the English countryside! (/me "does not trainspot, he just likes going on a train with his girlfriend.)"},"Pardon? Maz? Who's that?")
					else if(FindOrderedText(txt,"history"))
						NPCtext=pick ({"No one is quite certain what happened that evil day, when the earth shook and lightning lashed the spires of the castle. Anyone who was close enough to know was dead, killed in the maelstrom of horror that had engulfed the castle. Those farther away heard the echoing boom of giant drums, and the occasional sinister sound of devilish laughter. Rumors had been circulating in the weeks before that the king had been dealing in matters best left alone, but no one expected what actually came to pass. In the space of a day and a night, the castle of King Lifthransir was mostly destroyed. A few walls remained of the outer works, but its once proud spires were reduced to piles of rubble. As for the inner castle, which burrowed into the heart of the mountain, it was rumored to be largely intact. Few, however, were brave enough to venture beyond the forbidding gates of the castle, and even fewer returned. Even now, two decades later, the giant's drums can occasionally be heard echoing out of the bowels of the mountain, and the shade of King Lifthransir is reputed still to haunt the Great Hall of the castle.

For the lands once ruled by the Castle of the Winds, these have been dark and evil years. Bands of goblins and ogres, occasionally led by giants, have been raiding the settlements throughout the realm, and periodically strange creatures, like nightmare creations of a mad wizard, have issued forth from the castle to ravage the countryside. As a defense against these depredations, the people of the town of Crossroads have become skilled in producing arms and armor, and in creating enchanted items. Even so, life so close to the castle is precarious at best. As time has passed, people have even noticed changes in the weather. Strange storms spring up out of nowhere to lash the lands with lightning and rain, or dry spells during the spring when all should be green and growing, as if a malevolent force was trying to control the weather, and with it work ill across Midgard.

Prayers to the gods have gone unanswered. Despite the freak changes in the weather, even Thor has been silent. Perhaps, some say, the gods are helpless to do anything, or perhaps they are just waiting for a mortal to right the balance.

[src]'s Story so far..

Yours had been a fairly idyllic childhood. After the death of your parents shortly after your birth, you had been lovingly raised by your godparents in a small farming community. Of course there had been chores to do about the farm, which provided grist for your good natured complaints about overwork, but on the whole, life had been sweet. A discovery you made at age twelve, however, hinted that things might not always be this way. Hidden among the rafters of your farmhouse you discovered an ornately carved wooden box, whose tiny lock you couldn't open. After a few days of childish imaginings as to the contents of the box you couldn't hold out any longer, and asked your godfather what was in it. "Grandfather," you said, for while he was not truly your grandfather he seemed as close as one, "what's in the box under the eaves?"

His eyes opened wide, and he shot a look at your godmother who sat nearby. "Well," he said at last, "if ye be old enough to be askin', I guess ye be old enough to know. Why don't you fetch it here, child, and we'll take a look inside." Inside was a circular gold pendant suspended from a finely wrought gold chain. Your godfather went on to explain that it was a gift from your long dead father, and was to be yours on your eighteenth birthday. Your father had said that if you were worthy, the amulet would lead you to fortune and glory. "And so my child", your godfather said as he returned the amulet to the box, "you have much to live up to. Grow strong and wise, for the Norns have reached out and touched your life, as they do with few mortals, and I feel you will have need of all the talent and ability you can muster in whatever task lies ahead." Little did you expect what form that task might take. As your eighteenth birthday approached, you returned home one day to find your godparents dead and your farm burned. After burying the charred remains of your adopted familty, you searched the smoldering ruins of the farm, only to find that the amulet was missing. The only clues you found as to the identity of the attackers were giant humanoid footprints leading off towards the mountains. And thus began your odyssey of vengeance, as you sought to discover the identity of your family's murderers and avenge their death."})

					else if(FindOrderedText(txt,"jon" || "jon88"))
						NPCtext=pick ("Jon88 is a mystery to us all. He came, he saw: He conquered. Little details are known about him.","Incubus are sweet (lets not talk about Jon)","Jon, well Jon is a paradox. Hopefully he will see this whole section is pretty lame and empty. Therefore he will change it himself!")
					else if(FindOrderedText(txt,"splattergnome"))
						NPCtext=pick ({"Hes the gnome. He has a few scarey websites that make little sense e.g. the one for his film <a href = "http://www.worldofnixon.com">eyes of myra</a>, this site makes little sense to me but if any of you guys can make much sense feel free to do nothing with the info."},"splattergnome is sweet, he is making a dungeon thing","... Talk about splattergnome you say? Well, nah. I dont have the effort right now.")
					else if(FindOrderedText(txt,"stacey"))
						NPCtext=pick ("Stacey is who Maz has contributed this game too, she puts up with the world and only on rare occasions does she get annoyed with my coding")
					else if(FindOrderedText(txt,"links"))
						NPCtext=pick ({" <B>These are links to website to do with Castle of the Winds:</b><I> in order of last updated</I> <BR><a href = "http://members.chello.nl/a.vanpaassen1/">Cotw</a> by <a href = "mailto:Spruit_elf@gmx.net">Spruit_elf</a><BR><a href = "http://wind.prohosting.com/cotwrpg/">Temple of Odin</a> by <a href = "mailto:webmaster@cotwrpg.cjb.net">General Wesc</a><BR><a href = "http://vengeance.et.tudelft.nl/cow/">Castle of the Winds:Homepage</a> by <a href ="mailto:stimpy@vengeance.et.tudelft.nl">Jasper Blaas</a><BR>Then these are the links to do with our Castle of the Winds: <a href = "http://www.splatterlink.com/cotw">Our site</a>, our <a href = "http://www.bwicki.byond.com/ByondBwicki.dmb?CastleoftheWinds">Bwicki site</a> and our <a href ="http://games.byond.com/forums/Maz/CastleoftheWinds/index.cgi?action=forum_index">Forum</a> "})
					else if(FindOrderedText(txt,"ben" || "Ben")) // || = or
						NPCtext=pick ("Ben is Maz...","Maz is Ben...")
					else if(FindOrderedText(txt,"about"))
						var/players__p = ThingyList(players_list)
						NPCtext=pick ("Created by Team FourWinds. Castle of the Winds is originally a rogue-like created by Rick Saada for Saadasoft and Epic-Megagames.",{"Credits go out to: <a href = "http://www.byond.com/people/theodis">Theodis</a> <a href = "http://www.byond.com/people/foomer">Foomer</a>, <a href = "http://www.byond.com/people/flick">Flick</a>, <a href = "http://www.byond.com/people/nadrew">Nadrew</a>, <a href = "http://www.byond.com/people/dantom">Dantom</a>, <a href = "http://www.byond.com/people/spuzzum">Spuzzum</a> and of course [players__p]!  "})
					if(NPCtext<>"")
						sleep(2)
						saynpc(NPCtext, "Helper")

	dancers
		var/moved
		var/notactive
		density = 0
		icon = 'pc npc.dmi'
		d1
			icon_state = "dm"
		d2
			icon_state = "dm2"
		d3
			icon_state = "dm3"
		d4
			icon_state = "df"
			Dancebyatch()
				set background = 1
				moved = 0
				for(moved=0, moved<8, ++moved)
					step(src,dir)
					sleep(5)
					step(src,dir)
					sleep(5)
					step(src,dir)
					sleep(5)
					dir = turn(dir, 90)
					sleep(5)
				notactive = 0

		d5
			icon_state = "df2"
		proc
			Dancebyatch()
				set background = 1
				moved = 0
				for(moved=0, moved<8, ++moved)
					step(src,dir)
					sleep(5)
					step(src,dir)
					sleep(5)
					step(src,dir)
					sleep(5)
					dir = turn(dir, -45)
					sleep(5)
				notactive = 0

